package com.mccrea.pattern.flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 * @author mccrea
 * @version 1.0
 * @description: 网站工厂类，根据需求返回一个网站
 * @date 2021/5/12 21:16
 */
public class WebSiteFactory {

    private Map<String, ConcreteWebSite> pool = new HashMap<>();

    public WebSite getWebSiteCategory(String type) {
        if (!pool.containsKey(type)) {
            pool.put(type, new ConcreteWebSite(type));
        }
        return pool.get(type);
    }
}
